package com.wang.singleton;

import java.io.Serializable;

public class InnerClassSingleton implements Serializable {

    public static void main(String[] args) {
        InnerClassSingleton singleton = InnerClassSingleton.getInstance();
        InnerClassSingleton singleton1 = InnerClassSingleton.getInstance();
        System.out.println(singleton == singleton1);
    }


    private InnerClassSingleton(){}

    private static class Hodler{
        private static final InnerClassSingleton singleton = new InnerClassSingleton();
    }

    public static InnerClassSingleton getInstance(){
        return Hodler.singleton;
    }
}
